package com.sinosoft.dsp.component.bpm.util;

import java.util.ArrayList;
import java.util.List;

import javax.faces.model.SelectItem;

import com.sinosoft.dsp.system.core.property.BasePropertyHandler;

public enum JbpmTaskStateType {

	// 处理中
	ASSIGNED("assigned", BasePropertyHandler
			.getProperty("bpm.task.assigned.title")),

	// 待办
	UNASSIGNED("unassigned", BasePropertyHandler
			.getProperty("bpm.task.unassigned.title"));

	private static List<SelectItem> items;

	JbpmTaskStateType(String name, String title) {
		this.name = name;
		this.title = title;
	}

	private String name;

	private String title;

	public String getName() {
		return name;
	}

	public String getTitle() {
		return title;
	}

	public static List<SelectItem> getTaskStateItems() {
		if (items == null) {
			items = new ArrayList<SelectItem>();
			for (JbpmTaskStateType st : JbpmTaskStateType.values()) {
				items.add(new SelectItem(st.getName(), st.getTitle()));
			}
		}
		return items;
	}

}
